﻿using System.Threading.Tasks;

namespace MiniAspNetCore
{
    /// <summary>
    /// web宿主
    /// </summary>
    public class WebHost:IWebHost
    {
        private readonly IServer _server;
        private readonly RequestDelegate _hanlder;

        public WebHost(IServer server,RequestDelegate hanlder)
        {
            _server = server;
            _hanlder = hanlder;
        }

        /// <summary>
        /// 开启服务
        /// </summary>
        /// <returns></returns>
        public Task StartAsync() => _server.StartAsync(_hanlder); 
    }
}
